<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        /* 
        ### 其他数据类型转成布尔

1. `Boolean(变量)`
   - 在 js 中，只有 `''`、`0`、`null`、`undefined`、`NaN`，这些是 `false`，其余都是 `true`
        */
        console.log(Boolean(''));//f 
        console.log(Boolean(' '));//t
        console.log(Boolean(null));//f
        console.log(Boolean(undefined));//f
        console.log(Boolean(0));//f
        console.log(Boolean(NaN));//f
        console.log(Boolean('0'));//t
        console.log(Boolean('NaN'));//t

    </script>

</body>

</html>